package cc.yugu.yhdw.webserver.web.controller.security.hdw;

import cc.yugu.yhdw.common.annotation.ViewModel;
import cc.yugu.yhdw.common.domain.hdw.BatteryForegift;
import cc.yugu.yhdw.common.entity.json.ExtResult;
import cc.yugu.yhdw.webserver.constant.AppConstEnum;
import cc.yugu.yhdw.webserver.service.basic.DictItemService;
import cc.yugu.yhdw.webserver.service.hdw.BatteryForegiftService;
import cc.yugu.yhdw.webserver.web.controller.security.SecurityController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/security/hdw/battery_foregift")
public class BatteryForegiftController extends SecurityController {

    @Autowired
    BatteryForegiftService batteryForegiftService;
    @Autowired
    DictItemService dictItemService;

    @RequestMapping(value = "index.htm")
    public void index(Model model) {
        BatteryForegift batteryForegift = batteryForegiftService.find();
        model.addAttribute("batteryForegift", batteryForegift);
        model.addAttribute(MENU_CODE_NAME, AppConstEnum.Menu.MENU_03_15.getValue());
    }

    @RequestMapping("update.htm")
    @ViewModel(ViewModel.JSON)
    @ResponseBody
    public ExtResult update(double money) {
        return batteryForegiftService.update( money);
    }


}
